<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>设备报修</title>
    <link href="/widget/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet"  type="text/css"/>
    <link href="/widget/iconfont/iconfont.css" rel="stylesheet" />
    {cssjs}
    <link href="/res/css/inside_page.css" rel="stylesheet"  type="text/css"/>
    <script language="javascript" type="text/javascript" src="/widget/datepicker/WdatePicker.js"></script>
</head>

<body>
<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane">
                    <table class="layui-table">
                        <tbody>
                        <tr>
                            <td>申请人</td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-input-inline">
                                        <input type="text" name="name" value="{release_user}" required lay-verify="required" placeholder="申请人" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">必填</div>
                                </div>
                            </td>
                            <td>代办人</td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-input-inline">
                                        <input name="agent" id="name" value="{agent}" type="text" class="layui-input" placeholder="代办人">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">没有可不填</div>
                                </div>
                            </td>
                            <td>发布部门</td>
                            <td>
                                <div class="layui-input-inline">
                                    <select name="deptname" id="deptname" required lay-verify="required" lay-filter="deptname_select">
                                        <option value="">--请选择维修类型--</option>
                                        <!-- START list_department -->
                                        <option value="{id}">{deptname}</option>
                                        <!-- end list_department -->
                                    </select>
                                </div>
                            </td>

                        </td>
                        <tr>
                            <td>办公电话</td>
                            <td>
                                <div class="layui-form-item">
                                    <div class="layui-input-inline">
                                        <input name="contact_phone" id="name" value="{contact_phone}" required lay-verify="required"  type="text" class="layui-input" placeholder="办公电话" style="">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">必填</div>
                                </div>
                            </td>
                            <td>项目名称</td>
                            <td>
                                <div class="layui-form-item">
                                <div class="layui-input-inline">
                                    <input name="project_type" id="name" value='{project_type}' required lay-verify="required" type="text" class="layui-input" placeholder="项目名称" style="">
                                </div><div class="layui-form-mid layui-word-aux">必填</div>
                                </div>
                            </td>
                            <td>期望时间</td>
                            <td>
                                <div class="layui-input-inline">
                                    <input class="layui-input" name="takes_time" style="width:185px;" placeholder="期望时间" value="{takes_time}" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
                                </div>
                            </td>
                        </tr>
                            <td>报修类型</td>
                            <td>
                                <div class="layui-input-inline">
                                    <select name="repair_type" id="repair_type" required lay-verify="required" lay-filter="repair_select">
                                        <option value="">--请选择维修类型--</option>
                                            <!-- START repair_type -->
                                                <option value="{id}">{name}</option>
                                            <!-- end repair_type -->
                                    </select>
                                </div>
                            </td>
                            <td>维修人员</td>
                            <td colspan="3">
                                <div class="layui-input-inline">
                                    <select name="repair_user" id="repair_user" lay-filter="repair_user">
                                        <option value="">--请选择维修人员--</option>
                                    </select>
                                </div>
                            </td>
                        </tr>

                        <tr>
                            <td>维修地址</td>
                            <td colspan="5">
                                <textarea class="layui-textarea" value="" required lay-verify="required" name="takes_address" id="takes_address" placeholder="维修地址">{takes_address}</textarea>
                            </td>
                        </tr>
                        <tr>
                            <td>故障描述</td>
                            <td colspan="5">
                                <textarea class="layui-textarea" value="" required lay-verify="required" name="remark" id="remark" placeholder="故障描述">{code}</textarea>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="6">
                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <input type="text" id="id" name="id" value="{id}" style="display:none;"/>
                                        <input type="button" id="btn_save" lay-submit lay-filter="formDemo" value="立即提交" class="layui-btn"  />
                                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                    </div>
                                </div>
                            </td>

                        </tr>
                        <tr>
                            <td>申报说明：</td>
                            <td colspan="5">
                                <p> 1、请按表中项目的提示逐一认真填写。</p>

                                <p></p>2、项目的报修必须在网上填写该表，一般至少提前一天填写，有特殊情况的，经批准后电话或当面与信息中心联系，同事填写此表。</p>

                                <p>3、远程维修需要填写QQ号,办公电话和移动电话至少选择一项</p>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </section>
        </div>
    </div>
</div>
</body>
{jsmodel}
<script type="text/javascript">
    layui.use('repair_apple');
	var index = parent.layer.getFrameIndex(window.name);//获取当前弹出层的ID
	function showAccept(){
        var userid=$("#accept_id").val();
            //iframe层
              parent.layer.open({
              type: 2,
              title: '报修人选择',
              shadeClose: true,
              shade: 0.8,
              area: ['100%','100%'],
              content: './?t=select_accept&fid='+index+'&userid='+userid //iframe的url
            });
	}
    var department = "{department}";
    var takes_type = "{takes_type}";
    var len = $("#deptname option").length;
    var repa_len = $("#repair_type option").length;
    for (var i=0;i<len;i++){
        var item = $("#deptname option").eq(i).attr('value');
        if(item == department){
            $("#deptname option").eq(i).attr('selected','selected');
        }
    }
    for (var j=0;j<takes_type;j++){
        var item_pari = $("#repair_type option").eq(j).attr('value');
        if(item_pari == takes_type){
            $("#repair_type option").eq(j).attr('selected','selected');
        }
    }

//    var repair_id = $("#repair_type option:selected").val();
//    $.ajax({
//        datatype:'string',
//        type:'post',
//        data:{"repair_type":repair_id,"tpl":"get_repair_userlist"},
//        url:'./srv/rdo.php',
//        async:true,
//        success:function(d){
//            $("#repair_user").empty().html(d);
//            form.render('select');
//        }
//    });
//    var takes_user = "{takes_user}";
//    var takes_len = $("#repair_user option").length;
//    for (var k=0;k<takes_len;k++){
//        var takes_item = $("#repair_user option").eq(k).attr('value');
//        if(takes_item == takes_user){
//            $("#repair_user option").eq(k).attr('selected','selected');
//        }
//    }


</script>

</html>